<template>
    <div>
      <form action="" @submit.prevent="on">
        <input type="text" v-model="name">
        <input type="submit" value="添加">
      </form>
    </div>
</template>

<script>
  import axios from 'axios'
    export default {
        name: "add_role",
      data:function () {
        return{
          name:""
        }
      },
      methods:{
          on(){
            let form_data = new FormData()
            form_data.append('name',this.name)
            axios({
              url:"http://127.0.0.1:8000/add_role/",
              method:"post",
              data:form_data
            }).then(res=>{
              console.log(res)
            })
          }
      }
    }
</script>

<style scoped>

</style>
